home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / ENTRY.SWG / 0021_Re: Length Readln Example.pas < prev    next >
Pascal/Delphi Source File  |  1995-02-28  |  708b  |  39 lines

  1.  
  2. Program MaxInputDemo;
  3. { Released for SWAG; Public Domain, written by Andrew Eigus
  4.   Internet: aeigus@fgate.castle.riga.lv, aeigus@kristin.cclu.lv
  5.   Fidonet: 2:5100/33 }
  6.  
  7. Procedure lReadLn(var Str : string; MaxLength : byte); assembler;
  8. { Buffered string input from a standard console device }
  9. Asm
  10.   push ds
  11.   lds si,Str
  12.   mov dx,si
  13.   mov ah,0Ah
  14.   mov bl,MaxLength
  15.   inc bl
  16.   mov [si],bl
  17.   int 21h
  18.   les di,Str
  19.   cld
  20.   inc si
  21.   lodsb
  22.   mov cl,al
  23.   stosb
  24.   xor ch,ch
  25.   jcxz @@1
  26.   rep movsb
  27. @@1:
  28.   pop ds
  29. End; { lReadLn }
  30.  
  31. var S : string;
  32.  
  33. Begin
  34.   Write('Enter a string (max 10 characters) : ');
  35.   lReadln(S, 10);
  36.   WriteLn;
  37.   WriteLn('Entered string is "', S, '"')
  38. End.
  39.